import { ContainerHost } from "../Container";
import { BaseGui } from "../Services/BaseGui";
import { HighlightMan } from "../Services/highlight/HighlightMan";
import { SelectMan } from "../Services/select/SelectMan";
import { ViewerService } from "../Services/ViewerService";

export class LabGui extends BaseGui {
    title: string = `实验室[${LabGui.name}]`;
    Level = 1;
    guiService: any;
    private highlightMan!: HighlightMan;
    private selectMan!: SelectMan;
    protected UpdateGui(): void {
        let fun = {
            load_HighlightManager: () => {
                this.highlightMan = new HighlightMan(ContainerHost.Current.Get(ViewerService).viewer as any);
                this.highlightMan.load();
                window.alert("仅 模型集合中的数据 悬浮高亮");
            },
            unload_HighlightManager: () => {
                this.highlightMan.unload();
                window.alert("全部数据 悬浮高亮");
            },
            load_SelectManager: () => {
                this.selectMan = new SelectMan(ContainerHost.Current.Get(ViewerService).viewer as any);
                this.selectMan.load();
                window.alert("仅 模型集合中的数据 可以选择");
            },
            unload_SelectManager: () => {
                this.selectMan.unload();
                window.alert("全部数据 可以选择");
            },
        }
        let gui = this.gui;
        let updateGUI = () => {
            Array.from(gui.__controllers).forEach(_ => {
                gui.remove(_);
            });
            this.guiService.buildGUIByObject(this.gui, fun);
        }
        updateGUI();
    }
}